import { ReplacePageAni } from "../../core/game";
import { Serialize, SerializeClass } from "../../core/serialize";
import Utils from "../../core/utils";
import { Action } from "../eca/action";
import { ECACCNode } from "./eca_cc_node";

@SerializeClass("ActionReplacePage")
export class ActionReplacePage extends Action {
    @Serialize()
    pageName = "";
    async run(obj: any) {
        Utils.game.resReplacePage({
            name: this.pageName,
            ani: ReplacePageAni.Fade
        });
    }
};

@SerializeClass("ActionPushBox")
export class ActionPushBox extends Action {
    @Serialize()
    boxName = "";
    async run(obj: any) {
        Utils.game.resPushBox(this.boxName);
    }
};

@SerializeClass("ActionDestroyNode")
export class ActionDestroyNode extends Action {
    async run(obj: ECACCNode) {
        obj.node.destroy();
    }
};